package it.unibo.convoycruisecontrol.simulation;

import it.unibo.contact.chiefBoatSubSystem.ChiefBoatSubSystemLauncher;
import it.unibo.convoycruisecontrol.boatsubsystem.IBoatFactory;
import it.unibo.convoycruisecontrol.boatsubsystem.ObservableDashboard;
import it.unibo.convoycruisecontrol.boatsubsystem.presentation.swing.DashboardView;
import it.unibo.convoycruisecontrol.chiefboatsubsystem.ControlPanel;
import it.unibo.convoycruisecontrol.chiefboatsubsystem.IFlagDisplayFactory;
import it.unibo.convoycruisecontrol.chiefboatsubsystem.ObservableFlagDisplay;
import it.unibo.convoycruisecontrol.chiefboatsubsystem.presentation.swing.ChiefAndBoatFrame;
import it.unibo.convoycruisecontrol.chiefboatsubsystem.presentation.swing.ControlPanelController;
import it.unibo.convoycruisecontrol.chiefboatsubsystem.presentation.swing.ControlPanelView;
import it.unibo.convoycruisecontrol.chiefboatsubsystem.presentation.swing.FlagDisplayView;
import it.unibo.java.location.JavaLocationDeviceFactory;
import it.unibo.location.LocationDevice;
import it.unibo.mycruise.chief.FlagDisplayFactory;

public class SimulatorChiefLauncher extends ChiefBoatSubSystemLauncher
{

	@Override
	protected void configureSubjects() 
	{
		refreshPeriod = 3000;			// Aumento la frequenza di refresh visto che siamo su java SE
		
		super.configureSubjects();
	}
	
	@Override
	protected IFlagDisplayFactory getFlagDisplayFactory(String className) 
	{
		return new FlagDisplayFactory();
	}

	@Override
	protected IBoatFactory getBoatFactory(String className) 
	{
		return new SimulatorBoatFactory();
	}

	@Override
	protected LocationDevice getLocationDevice(String deviceName) 
	{
		JavaLocationDeviceFactory devFactory = new JavaLocationDeviceFactory();
		return devFactory.createBestDevice();
	}

	@Override
	protected void initGui() 
	{
		ControlPanelController controlPanelController = new ControlPanelController((ControlPanel) controlPanel);
		ControlPanelView controlPanelView = new ControlPanelView(controlPanelController);
		FlagDisplayView flagDisplayView = new FlagDisplayView((ObservableFlagDisplay) flagDisplay);
		DashboardView dashView = new DashboardView((ObservableDashboard) dashboard);
		new ChiefAndBoatFrame(controlPanelView, flagDisplayView, dashView);

	}

}
